The present disclosure relates to a method for enabling sequential, non-blocking processing of statements in concurrent tasks in a control device having an operating system capable of multitasking, in particular a programmable logic controller (PLC), and to a control device and a computer program.
Different variants of programmable logic controllers are known. These are devices which are used to control or regulate a machine or system and are digitally programmed. Programmable logic controllers have superseded the hard-wired (hard-wired programmed) controllers used in the past and, like the latter, primarily operate in a state-oriented manner.
The European standard EN 61131, which corresponds to the international standard IEC 61131, deals with principles of programmable logic controllers and comprises, in part 3 (IEC/EN 61131-3) definitions of programming languages used in programmable logic controllers.
EN/IEC 61131-3 defines the following programming languages or rules: “instruction list” (IL), “ladder diagram” (LD), “function block diagram” (FBD), “sequential function chart” (SFC) and “structured text” (ST). The programming language ST, in particular, is based on known high-level programming languages and is also referred to as the structured control language. The languages IL and ST are text-based languages and the remaining languages (LD, FBD, SFC) are graphical forms. In all of the languages mentioned, it is possible to use functions and function blocks which were previously defined in another language and/or are provided by the manufacturer of a corresponding programmable logic controller in the form of software libraries (in binary form even without source code).
In the case of programmable logic controllers, the control program which is defined by the user is stored in a special electronically readable memory. Programs are processed in a programmable logic controller by the central processing unit (CPU), statements generally being processed in a cyclical manner. In this case, the programmable logic controller first of all assumes the signal states of the inputs, as a result of which the process image of the inputs is renewed. In a next step, an application program is processed statement by statement. During a necessary interrogation of the signal states of the inputs, the previously generated process image is accessed. After the statements have been processed step by step, the process image of the outputs is transmitted in the form of the current state and the cycle is thus ended. The described sequence (input image, processing, output image) is typically carried out within one task. The programmable logic controller then begins to execute the task with the next priority. Said cyclical program processing can be carried out in the form of synchronous (fixed, that is to say isochronous) or asynchronous cycles.
Programmable logic controllers may also operate in an event-controlled manner, in a status-controlled manner or in a freely running manner.
In the case of free-running tasks within a programmable logic controller, processing is effected in a “round robin” method at a low-priority level. The processing sequence corresponds to the abovementioned cyclical processing but no cycle time is defined. Therefore, very long processing times in comparison with cyclical tasks may occur, as a result of which the problem may arise of the input images “ageing” and of the output images not being renewed in good time. Therefore, as stated in more detail below, the previously explained renewal of the input process image and the transmission of the output process image, in particular, must be carried out independently thereof (for example in a concurrent task).
During the cyclical processing of statements in programmable logic controllers, in particular, the problem arises of the operating time of a processor of the programmable logic controller often not being used in an optimal manner because a distinction is not made between process data processing (cyclical tasks with a higher priority) and sequence control (sequential, low-priority, free-running tasks) in the use of tasks. Rather, sequence control is achieved by using sequencer management or SFC within the cyclical tasks. Therefore, the prioritization (cycle time) of the tasks must be designed in such a manner that all tasks can always comply with their maximum computation time (watchdog time). This “worst case” consideration results in ineffective use of the computation time since a shorter computation time is required in the normal state and the then unused computation time is virtually lost. In addition, a considerable amount of additional complexity arises when programming the sequencer or in the sequential function chart in comparison with sequentially operating commands since the latter implicitly implement the step enabling conditions.
In order to allocate computation time to tasks, so-called multitasking functions are available in computer systems. Multitasking or multi-process operation denotes the concurrent execution of a plurality of tasks by an operating system. For this purpose, different processes are activated in a cyclically repeating or freely running manner in a predefined order or priority, thus giving the impression of simultaneous processing.
It is desirable to specify processing of statements in concurrent tasks in a control device, in particular in a programmable logic controller, during which non-blocking execution of free-running tasks, in particular, is enabled in the form of multitasking using known programming languages, in particular structured text.